﻿namespace Library
{
    using System;
    using System.Data;
    using System.Drawing;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Text.RegularExpressions;
    using System.Windows.Forms;

    public class Navigator : Panel
    {
        private winxpbutton btFirst;
        private winxpbutton btGotoPage;
        private winxpbutton btLast;
        private winxpbutton btNext;
        private winxpbutton btPrevious;
        private DataGridView dgv = null;
        private Label lblCurrentPage;
        private Label lblGotoPage;
        private Label lblGotoPageTip;
        private Label lblPageCount;
        private Label lblRowsCount;
        private Label lblSeparator;
        private int pageSize = 0x12;
        private Pagination pagination = new Pagination();
        private DataTable table = null;
        private TextBox txtGotoPage;

        public event LoadViewStatusHandler OnLoadViewStatus;

        public event PageIndexChangingHandler OnPageIndexChanging;

        public event SaveViewStatusHandler OnSaveViewStatus;

        public Navigator()
        {
            this.InitializeComponent();
            this.RaiseEventAndInitNavigator();
            this.ResetControlPoint();
        }

        private void btFirst_Click(object sender, EventArgs e)
        {
            this.NavigatorAction("First");
        }

        private void btGotoPage_Click(object sender, EventArgs e)
        {
            this.NavigatorAction("Goto");
        }

        private void btLast_Click(object sender, EventArgs e)
        {
            this.NavigatorAction("Last");
        }

        private void btNext_Click(object sender, EventArgs e)
        {
            this.NavigatorAction("Next");
        }

        private void btPrevious_Click(object sender, EventArgs e)
        {
            this.NavigatorAction("Previous");
        }

        private void DataBand(Pagination page)
        {
            this.SetPageCount(page.PageCount.ToString());
            this.SetPageCurrent(page.PageCurrent.ToString());
            this.GridViewBanding(page.CurrentPageDataSource);
        }

        public void DataBind()
        {
            this.pagination.SetCurrentPageData();
        }

        private Image GetImage(string path)
        {
            string str = MethodBase.GetCurrentMethod().DeclaringType.Namespace;
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            string name = str + ".Resources." + path;
            return Image.FromStream(executingAssembly.GetManifestResourceStream(name));
        }

        private void GridViewBanding(DataTable table)
        {
            if (this.dgv.InvokeRequired)
            {
                GridViewBandingCallback method = new GridViewBandingCallback(this.GridViewBanding);
                this.dgv.Invoke(method, new object[] { table });
            }
            else
            {
                this.dgv.DataSource = table;
            }
        }

        public void Init()
        {
            this.NavigatorAction("Init");
        }

        private void InitializeComponent()
        {
            this.btFirst = new winxpbutton();
            this.btPrevious = new winxpbutton();
            this.btNext = new winxpbutton();
            this.btLast = new winxpbutton();
            this.lblCurrentPage = new Label();
            this.lblSeparator = new Label();
            this.lblPageCount = new Label();
            this.lblGotoPage = new Label();
            this.txtGotoPage = new TextBox();
            this.btGotoPage = new winxpbutton();
            this.lblGotoPageTip = new Label();
            this.lblRowsCount = new Label();
            base.SuspendLayout();
            this.btFirst.Name = "btFirst";
            this.btFirst.Size = new Size(0x12, 15);
            this.btFirst.TabIndex = 1;
            this.btFirst.Text = " ";
            this.btFirst.textcolor = Color.Black;
            this.btFirst.UseVisualStyleBackColor = true;
            this.btFirst.Location = new Point(0, 0);
            this.btFirst.FlatStyle = FlatStyle.Popup;
            this.btFirst.ToolTipText = "移动至第一页";
            this.btFirst.Image = this.GetImage("First.Image.png");
            this.btFirst.Click += new EventHandler(this.btFirst_Click);
            this.btPrevious.Location = new Point(0, 0);
            this.btPrevious.Name = "btPrevious";
            this.btPrevious.Size = new Size(0x12, 15);
            this.btPrevious.TabIndex = 2;
            this.btPrevious.textcolor = Color.Black;
            this.btPrevious.UseVisualStyleBackColor = true;
            this.btPrevious.Location = new Point(20, 0);
            this.btPrevious.FlatStyle = FlatStyle.Popup;
            this.btPrevious.ToolTipText = "移动至上一页";
            this.btPrevious.Image = this.GetImage("Previous.Image.png");
            this.btPrevious.Click += new EventHandler(this.btPrevious_Click);
            this.lblCurrentPage.AutoSize = true;
            this.lblCurrentPage.Name = "lblCurrentPage";
            this.lblCurrentPage.Size = new Size(20, 0x17);
            this.lblCurrentPage.TabIndex = 3;
            this.lblCurrentPage.Location = new Point(40, 2);
            this.lblCurrentPage.Text = "0";
            this.lblSeparator.AutoSize = true;
            this.lblSeparator.Name = "lblSeparator";
            this.lblSeparator.Size = new Size(10, 0x17);
            this.lblSeparator.TabIndex = 4;
            this.lblSeparator.Text = "/";
            this.lblSeparator.Location = new Point(0x4b, 2);
            this.lblPageCount.AutoSize = true;
            this.lblPageCount.Name = "lblPageCount";
            this.lblPageCount.Size = new Size(20, 0x17);
            this.lblPageCount.Location = new Point(0x55, 2);
            this.lblPageCount.TabIndex = 5;
            this.lblPageCount.Text = "0";
            this.btNext.Location = new Point(0x7d, 0);
            this.btNext.Name = "btNext";
            this.btNext.Size = new Size(0x12, 15);
            this.btNext.TabIndex = 6;
            this.btNext.Text = " ";
            this.btNext.textcolor = Color.Black;
            this.btNext.UseVisualStyleBackColor = true;
            this.btNext.FlatStyle = FlatStyle.Popup;
            this.btNext.ToolTipText = "移动至下一页";
            this.btNext.Image = this.GetImage("Next.Image.png");
            this.btNext.Click += new EventHandler(this.btNext_Click);
            this.btLast.Location = new Point(0x91, 0);
            this.btLast.Name = "btLast";
            this.btLast.Size = new Size(0x12, 15);
            this.btLast.TabIndex = 7;
            this.btLast.Text = " ";
            this.btLast.textcolor = Color.Black;
            this.btLast.UseVisualStyleBackColor = true;
            this.btLast.FlatStyle = FlatStyle.Popup;
            this.btLast.ToolTipText = "移动至最后一页";
            this.btLast.Image = this.GetImage("Last.Image.png");
            this.btLast.Click += new EventHandler(this.btLast_Click);
            this.lblGotoPage.AutoSize = true;
            this.lblGotoPage.Name = "lblGotoPage";
            this.lblGotoPage.Size = new Size(20, 0x17);
            this.lblGotoPage.TabIndex = 8;
            this.lblGotoPage.Text = "转到第";
            this.lblGotoPage.Location = new Point(0xb9, 2);
            this.txtGotoPage.AutoSize = true;
            this.txtGotoPage.Name = "txtGotoPage";
            this.txtGotoPage.Size = new Size(50, 0x10);
            this.txtGotoPage.TabIndex = 0;
            this.txtGotoPage.Text = "";
            this.txtGotoPage.Location = new Point(0xe3, 0);
            this.txtGotoPage.BorderStyle = BorderStyle.FixedSingle;
            this.txtGotoPage.Multiline = true;
            this.txtGotoPage.KeyPress += new KeyPressEventHandler(this.txtGotoPage_KeyPress);
            this.txtGotoPage.WordWrap = false;
            this.txtGotoPage.MaxLength = 9;
            this.lblGotoPageTip.AutoSize = true;
            this.lblGotoPageTip.Name = "lblGotoPageTip";
            this.lblGotoPageTip.Size = new Size(20, 0x17);
            this.lblGotoPageTip.TabIndex = 9;
            this.lblGotoPageTip.Text = "页";
            this.lblGotoPageTip.Location = new Point(0x117, 2);
            this.btGotoPage.Location = new Point(0x129, 0);
            this.btGotoPage.Name = "btGotoPage";
            this.btGotoPage.Size = new Size(0x12, 15);
            this.btGotoPage.TabIndex = 10;
            this.btGotoPage.Text = " ";
            this.btGotoPage.textcolor = Color.Black;
            this.btGotoPage.UseVisualStyleBackColor = true;
            this.btGotoPage.FlatStyle = FlatStyle.Popup;
            this.btGotoPage.ToolTipText = "移动至特定页";
            this.btGotoPage.Image = this.GetImage("Goto.Image.png");
            this.btGotoPage.Click += new EventHandler(this.btGotoPage_Click);
            this.lblRowsCount.AutoSize = true;
            this.lblRowsCount.Name = "lblRowsCount";
            this.lblRowsCount.Size = new Size(20, 0x17);
            this.lblRowsCount.TabIndex = 11;
            this.lblRowsCount.Text = "共 0 条数据";
            this.lblRowsCount.Location = new Point(0x14f, 2);
            base.Controls.Add(this.btFirst);
            base.Controls.Add(this.btPrevious);
            base.Controls.Add(this.lblCurrentPage);
            base.Controls.Add(this.lblSeparator);
            base.Controls.Add(this.lblPageCount);
            base.Controls.Add(this.btNext);
            base.Controls.Add(this.btLast);
            base.Controls.Add(this.lblGotoPage);
            base.Controls.Add(this.txtGotoPage);
            base.Controls.Add(this.lblGotoPageTip);
            base.Controls.Add(this.btGotoPage);
            base.Controls.Add(this.lblRowsCount);
            base.Size = new Size(400, 0x12);
            base.ResumeLayout(false);
        }

        private void NavigatorAction(string flag)
        {
            this.SetButtonFocus(this.txtGotoPage);
            this.RaiseEventAndInitNavigator();
            this.pagination.DataSource = this.table;
            this.pagination.PageSize = this.pageSize;
            if (this.OnSaveViewStatus != null)
            {
                this.OnSaveViewStatus();
            }
            if (flag == "Init")
            {
                this.pagination.SetFirstPageData();
            }
            if (flag == "First")
            {
                this.SetNavigatorProviousDisable();
                this.pagination.PageCurrent = 1;
                this.pagination.NCurrent = 0;
            }
            if (flag == "Previous")
            {
                this.pagination.PageCurrent--;
                if (this.pagination.PageCurrent <= 0)
                {
                    MessageBox.Show("已经是第一页，请点击“下一页”查看！");
                    return;
                }
                this.pagination.NCurrent = this.pagination.PageSize * (this.pagination.PageCurrent - 1);
                if (this.pagination.PageCurrent <= 1)
                {
                    this.SetNavigatorProviousDisable();
                }
                else
                {
                    this.SetNavigatorEnable();
                }
                this.pagination.SetCurrentPageData();
            }
            if (flag == "Last")
            {
                this.SetNavigatorNextDisable();
                this.pagination.PageCurrent = this.pagination.PageCount;
                this.pagination.NCurrent = this.pagination.PageSize * (this.pagination.PageCount - 1);
            }
            if (flag == "Next")
            {
                this.pagination.PageCurrent++;
                if (this.pagination.PageCurrent > this.pagination.PageCount)
                {
                    MessageBox.Show("已经是最后一页，请点击“上一页”查看！");
                    return;
                }
                this.pagination.NCurrent = this.pagination.PageSize * (this.pagination.PageCurrent - 1);
                if (this.pagination.PageCurrent == this.pagination.PageCount)
                {
                    this.SetNavigatorNextDisable();
                }
                else
                {
                    this.SetNavigatorEnable();
                }
            }
            if (flag == "Goto")
            {
                Regex regex = new Regex(@"^[1-9]\d*$");
                if (!regex.Match(this.txtGotoPage.Text.Trim()).Success)
                {
                    if (this.pagination.PageCurrent == 1)
                    {
                        this.SetNavigatorProviousDisable();
                    }
                    else if (this.pagination.PageCurrent == this.pagination.PageCount)
                    {
                        this.SetNavigatorNextDisable();
                    }
                    else
                    {
                        this.SetNavigatorEnable();
                    }
                    MessageBox.Show(this, "请输入正确的跳转页数!");
                    return;
                }
                if (Convert.ToInt32(this.txtGotoPage.Text) < 1)
                {
                    if (this.pagination.PageCurrent == 1)
                    {
                        this.SetNavigatorProviousDisable();
                    }
                    else if (this.pagination.PageCurrent == this.pagination.PageCount)
                    {
                        this.SetNavigatorNextDisable();
                    }
                    else
                    {
                        this.SetNavigatorEnable();
                    }
                    MessageBox.Show(this, "请输入的跳转页数小于最少页!");
                    return;
                }
                if (Convert.ToInt32(this.txtGotoPage.Text) > this.pagination.PageCount)
                {
                    if (this.pagination.PageCurrent == 1)
                    {
                        this.SetNavigatorProviousDisable();
                    }
                    else if (this.pagination.PageCurrent == this.pagination.PageCount)
                    {
                        this.SetNavigatorNextDisable();
                    }
                    else
                    {
                        this.SetNavigatorEnable();
                    }
                    MessageBox.Show(this, "请输入的跳转页数大于总页数!");
                    return;
                }
                this.pagination.PageCurrent = Convert.ToInt32(this.txtGotoPage.Text);
                this.pagination.NCurrent = this.pagination.PageSize * (this.pagination.PageCurrent - 1);
                if (this.pagination.PageCurrent == 1)
                {
                    this.SetNavigatorProviousDisable();
                }
                else if (this.pagination.PageCurrent == this.pagination.PageCount)
                {
                    this.SetNavigatorNextDisable();
                }
                else
                {
                    this.SetNavigatorEnable();
                }
            }
            this.DataBand(this.pagination);
            this.txtGotoPage.Text = "";
            this.ResetControlPoint();
            if (this.OnLoadViewStatus != null)
            {
                this.OnLoadViewStatus();
            }
        }

        private void RaiseEventAndInitNavigator()
        {
            if (this.OnPageIndexChanging != null)
            {
                this.OnPageIndexChanging();
            }
            if ((this.table == null) || (this.table.Rows.Count == 0))
            {
                this.SetNavigatorDisable();
            }
            else
            {
                if (this.pageSize == 0)
                {
                    this.SetNavigatorDisable();
                }
                else
                {
                    this.SetNavigatorProviousDisable();
                }
                this.SetRowsCount("共 " + this.RowCount.ToString() + " 条数据");
            }
        }

        private void ResetControlPoint()
        {
            this.SetControlLocation(this.btFirst, new Point(0, 0));
            this.SetControlLocation(this.btPrevious, new Point((this.btFirst.Location.X + this.btFirst.Width) + 2, 0));
            this.SetControlLocation(this.lblCurrentPage, new Point((this.btPrevious.Location.X + this.btPrevious.Width) + 10, 2));
            this.SetControlLocation(this.lblSeparator, new Point(this.lblCurrentPage.Location.X + this.lblCurrentPage.Width, 2));
            this.SetControlLocation(this.lblPageCount, new Point(this.lblSeparator.Location.X + this.lblSeparator.Width, 2));
            this.SetControlLocation(this.btNext, new Point((this.lblPageCount.Location.X + this.lblPageCount.Width) + 10, 0));
            this.SetControlLocation(this.btLast, new Point((this.btNext.Location.X + this.btNext.Width) + 2, 0));
            this.SetControlLocation(this.lblGotoPage, new Point((this.btLast.Location.X + this.btLast.Width) + 20, 2));
            this.SetControlLocation(this.txtGotoPage, new Point((this.lblGotoPage.Location.X + this.lblGotoPage.Width) + 2, 0));
            this.SetControlLocation(this.lblGotoPageTip, new Point((this.txtGotoPage.Location.X + this.txtGotoPage.Width) + 2, 2));
            this.SetControlLocation(this.btGotoPage, new Point((this.lblGotoPageTip.Location.X + this.lblGotoPageTip.Width) + 2, 0));
            this.SetControlLocation(this.lblRowsCount, new Point((this.btGotoPage.Location.X + this.btGotoPage.Width) + 20, 2));
            this.SetControlSize(new Size(this.lblRowsCount.Location.X + this.lblRowsCount.Width, 0x12));
        }

        private void SetButtonFocus(TextBox txt)
        {
            if (txt.InvokeRequired)
            {
                SetButtonFocusCallback method = new SetButtonFocusCallback(this.SetButtonFocus);
                txt.Invoke(method, new object[] { txt });
            }
            else
            {
                txt.Focus();
            }
        }

        private void SetControlLocation(Control contronl, Point point)
        {
            if (contronl.InvokeRequired)
            {
                SetControlLocationCallback method = new SetControlLocationCallback(this.SetControlLocation);
                contronl.Invoke(method, new object[] { contronl, point });
            }
            else
            {
                contronl.Location = point;
            }
        }

        private void SetControlSize(Size size)
        {
            if (base.InvokeRequired)
            {
                SetControlSizeCallBack method = new SetControlSizeCallBack(this.SetControlSize);
                base.Invoke(method, new object[] { size });
            }
            else
            {
                base.Size = size;
            }
        }

        private void SetNavigatorButtonEnable(Button bt, bool value)
        {
            if (bt.InvokeRequired)
            {
                SetNavigatorBttonEnableCallback method = new SetNavigatorBttonEnableCallback(this.SetNavigatorButtonEnable);
                bt.Invoke(method, new object[] { bt, value });
            }
            else
            {
                bt.Enabled = value;
            }
        }

        private void SetNavigatorDisable()
        {
            this.SetNavigatorButtonEnable(this.btFirst, false);
            this.SetNavigatorButtonEnable(this.btPrevious, false);
            this.SetNavigatorLabelEnable(this.lblCurrentPage, false);
            this.SetNavigatorLabelEnable(this.lblSeparator, false);
            this.SetNavigatorLabelEnable(this.lblPageCount, false);
            this.SetNavigatorButtonEnable(this.btNext, false);
            this.SetNavigatorButtonEnable(this.btLast, false);
            this.SetNavigatorLabelEnable(this.lblGotoPage, false);
            this.SetNavigatorTextBoxEnable(this.txtGotoPage, false);
            this.SetNavigatorLabelEnable(this.lblGotoPageTip, false);
            this.SetNavigatorButtonEnable(this.btGotoPage, false);
            this.SetNavigatorLabelEnable(this.lblRowsCount, false);
        }

        private void SetNavigatorEnable()
        {
            this.SetNavigatorButtonEnable(this.btFirst, true);
            this.SetNavigatorButtonEnable(this.btPrevious, true);
            this.SetNavigatorLabelEnable(this.lblCurrentPage, true);
            this.SetNavigatorLabelEnable(this.lblSeparator, true);
            this.SetNavigatorLabelEnable(this.lblPageCount, true);
            this.SetNavigatorButtonEnable(this.btNext, true);
            this.SetNavigatorButtonEnable(this.btLast, true);
            this.SetNavigatorLabelEnable(this.lblGotoPage, true);
            this.SetNavigatorTextBoxEnable(this.txtGotoPage, true);
            this.SetNavigatorLabelEnable(this.lblGotoPageTip, true);
            this.SetNavigatorButtonEnable(this.btGotoPage, true);
            this.SetNavigatorLabelEnable(this.lblRowsCount, true);
        }

        private void SetNavigatorLabelEnable(Label lbl, bool value)
        {
            if (lbl.InvokeRequired)
            {
                SetNavigatorLabelEnableCallback method = new SetNavigatorLabelEnableCallback(this.SetNavigatorLabelEnable);
                lbl.Invoke(method, new object[] { lbl, value });
            }
            else
            {
                lbl.Enabled = value;
            }
        }

        private void SetNavigatorNextDisable()
        {
            this.SetNavigatorButtonEnable(this.btFirst, true);
            this.SetNavigatorButtonEnable(this.btPrevious, true);
            this.SetNavigatorLabelEnable(this.lblCurrentPage, true);
            this.SetNavigatorLabelEnable(this.lblSeparator, true);
            this.SetNavigatorLabelEnable(this.lblPageCount, true);
            this.SetNavigatorButtonEnable(this.btNext, false);
            this.SetNavigatorButtonEnable(this.btLast, false);
        }

        private void SetNavigatorProviousDisable()
        {
            this.SetNavigatorButtonEnable(this.btFirst, false);
            this.SetNavigatorButtonEnable(this.btPrevious, false);
            this.SetNavigatorLabelEnable(this.lblCurrentPage, true);
            this.SetNavigatorLabelEnable(this.lblSeparator, true);
            this.SetNavigatorLabelEnable(this.lblPageCount, true);
            this.SetNavigatorButtonEnable(this.btNext, true);
            this.SetNavigatorButtonEnable(this.btLast, true);
            this.SetNavigatorLabelEnable(this.lblGotoPage, true);
            this.SetNavigatorTextBoxEnable(this.txtGotoPage, true);
            this.SetNavigatorLabelEnable(this.lblGotoPageTip, true);
            this.SetNavigatorButtonEnable(this.btGotoPage, true);
            this.SetNavigatorLabelEnable(this.lblRowsCount, true);
        }

        private void SetNavigatorTextBoxEnable(TextBox txt, bool value)
        {
            if (txt.InvokeRequired)
            {
                SetNavigatorTextBoxEnableCallback method = new SetNavigatorTextBoxEnableCallback(this.SetNavigatorTextBoxEnable);
                txt.Invoke(method, new object[] { txt, value });
            }
            else
            {
                txt.Enabled = value;
            }
        }

        private void SetPageCount(string value)
        {
            if (this.lblPageCount.InvokeRequired)
            {
                SetPageCountCallback method = new SetPageCountCallback(this.SetPageCount);
                this.lblPageCount.Invoke(method, new object[] { value });
            }
            else
            {
                this.lblPageCount.Text = value;
            }
        }

        private void SetPageCurrent(string value)
        {
            if (this.lblCurrentPage.InvokeRequired)
            {
                SetPageCurrentCallback method = new SetPageCurrentCallback(this.SetPageCurrent);
                this.lblCurrentPage.Invoke(method, new object[] { value });
            }
            else
            {
                this.lblCurrentPage.Text = value;
            }
        }

        private void SetRowsCount(string value)
        {
            if (this.lblRowsCount.InvokeRequired)
            {
                SetRowsCountCallback method = new SetRowsCountCallback(this.SetRowsCount);
                this.lblRowsCount.Invoke(method, new object[] { value });
            }
            else
            {
                this.lblRowsCount.Text = value;
            }
        }

        private void txtGotoPage_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                e.Handled = true;
            }
        }

        public DataGridView DataContainer
        {
            set
            {
                this.dgv = value;
            }
        }

        public DataTable DataSource
        {
            set
            {
                this.table = value;
            }
        }

        public int PageCurrent
        {
            get
            {
                return this.pagination.PageCurrent;
            }
        }

        public int PageSize
        {
            get
            {
                return this.pageSize;
            }
            set
            {
                this.pageSize = value;
            }
        }

        public int RowCount
        {
            get
            {
                return this.pagination.NMax;
            }
            set
            {
                this.pagination.NMax = value;
                this.SetRowsCount("共 " + value + " 条数据");
            }
        }

        private delegate void GridViewBandingCallback(DataTable table);

        public delegate void LoadViewStatusHandler();

        public delegate void PageIndexChangingHandler();

        private class Pagination
        {
            private DataTable dtCurrentPageData = new DataTable();
            private DataTable dtInfo = new DataTable();
            private int nCurrent = 0;
            private int nMax = 0;
            private int pageCount = 0;
            private int pageCurrent = 0;
            private int pageSize = 0;

            public void SetCurrentPageData()
            {
                if (this.dtInfo != null)
                {
                    this.dtCurrentPageData = this.dtInfo;
                }
            }

            public void SetFirstPageData()
            {
                if ((this.pageSize == 0) || (this.nMax == 0))
                {
                    this.dtCurrentPageData = this.dtInfo;
                    if (this.nMax > 0)
                    {
                        this.pageCurrent = 1;
                        this.pageCount = 1;
                        this.nCurrent = 0;
                    }
                }
                else
                {
                    this.pageCount = this.nMax / this.pageSize;
                    if ((this.nMax % this.pageSize) > 0)
                    {
                        this.pageCount++;
                    }
                    this.pageCurrent = 1;
                    this.nCurrent = 0;
                    this.SetCurrentPageData();
                }
            }

            public DataTable CurrentPageDataSource
            {
                get
                {
                    return this.dtCurrentPageData;
                }
                set
                {
                    this.dtCurrentPageData = value;
                }
            }

            public DataTable DataSource
            {
                get
                {
                    return this.dtInfo;
                }
                set
                {
                    this.dtInfo = value;
                }
            }

            public int NCurrent
            {
                get
                {
                    return this.nCurrent;
                }
                set
                {
                    this.nCurrent = value;
                }
            }

            public int NMax
            {
                get
                {
                    return this.nMax;
                }
                set
                {
                    this.nMax = value;
                }
            }

            public int PageCount
            {
                get
                {
                    return this.pageCount;
                }
                set
                {
                    this.pageCount = value;
                }
            }

            public int PageCurrent
            {
                get
                {
                    return this.pageCurrent;
                }
                set
                {
                    this.pageCurrent = value;
                }
            }

            public int PageSize
            {
                get
                {
                    return this.pageSize;
                }
                set
                {
                    this.pageSize = value;
                }
            }
        }

        public delegate void SaveViewStatusHandler();

        private delegate void SetButtonFocusCallback(TextBox txt);

        private delegate void SetControlLocationCallback(Control control, Point point);

        private delegate void SetControlSizeCallBack(Size size);

        private delegate void SetNavigatorBttonEnableCallback(Button bt, bool value);

        private delegate void SetNavigatorLabelEnableCallback(Label lbl, bool value);

        private delegate void SetNavigatorTextBoxEnableCallback(TextBox txt, bool value);

        private delegate void SetPageCountCallback(string value);

        private delegate void SetPageCurrentCallback(string value);

        private delegate void SetRowsCountCallback(string value);
    }
}

